<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('饲料库存列表')" />
</head>
<body class="gray-bg">

		<div class="row">
			<div class="container-div">
				<div class="col-sm-12 search-collapse">
					<div class="btn-group " style="margin: 0px auto;display: table;" role="group">
						<button type="button" class="top-link btn btn-sm btn-primary">主饲料管理</button>
						<button type="button" class="top-link btn-sm btn-white">主饲料饲喂记录</button>
					</div>

				</div>
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<!--<li>
								饲料批次：<input type="text" name="feedCode"/>
							</li>-->

							<li>
								饲料名称：<input type="text" name="feedName"/>
							</li>


							<li class="select-time">
								<label>入库时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间"
									   name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间"
									   name="params[endTime]"/>
							</li>


							<!--<li>
								入库时间：<input type="text" name="createTime"/>
							</li>-->

							<li>
								经手人：<input type="text" name="createBy"/>
							</li>

							<!--<li>
								有效期：<input type="text" name="validDate"/>
							</li>-->

							<li>
								采购人：<input type="text" name="purchaser"/>
							</li>


							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

	        <!--<div class="btn-group-sm" id="toolbar" role="group">-->
				<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncFeed:add">-->
					<!--<i class="fa fa-plus"></i> 添加-->
				<!--</a>-->
				<!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ncFeed:edit">-->
					<!--<i class="fa fa-edit"></i> 修改-->
				<!--</a>-->
				<!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ncFeed:remove">-->
					<!--<i class="fa fa-remove"></i> 删除-->
				<!--</a>-->
				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncFeed:export">-->
						<!--<i class="fa fa-download"></i> 导出-->
				 <!--</a>-->
			<!--</div>-->
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:ncFeed:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:ncFeed:remove')}]];
		var depotFlag = [[${@permission.hasPermi('system:ncGoods:depot')}]];
        var prefix = ctx + "system/ncChickenFeed";

        $(function() {
            var options = {
                url: prefix + "/list?feedType=1&managerType=1" ,
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "饲料库存",
		        showExport: false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'feedId',
					title : '饲料id',
					visible: false
				},
				{
					field : 'feedCode',
					title : '饲料批次',
					sortable: true
				},
				{
					field : 'meterialName',
					title : '饲料名称',
					sortable: true
				},
				{
					field : 'factory',
					title : '生产厂家',
					sortable: true
				},
				{
					field : 'inputAmount',
					title : '入库数量(kg)',
					sortable: true
				},
				{
					field : 'stockAmout',
					title : '库存(kg)',
					sortable: true
				},
				/*{
					field : 'unit',
					title : '单位',
					sortable: true
				},*/
				{
					field : 'createTime',
					title : '入库时间',
					sortable: true
				},
				{
					field : 'createBy',
					title : '经手人',
					sortable: true
				},
				{
					field : 'validDate',
					title : '有效期',
					sortable: true
				},
				{
					field : 'purchaser',
					title : '采购人',
					sortable: true
				},
				{
					field : 'remark',
					title : '备注',
					sortable: true
				},
				/*{
						field : 'feedType',
						title : '饲料类型 1:主饲料 2：辅饲料',
						sortable: true
					},
					{
						field : 'managerType',
						title : '管理类型 1:鸡舍 2：牛舍',
						sortable: true
					},*/
		        // {
		        //     title: '操作',
		        //     align: 'center',
		        //     formatter: function(value, row, index) {
		        //     	var actions = [];
		        //     	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.feedId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.feedId + '\')"><i class="fa fa-remove"></i>删除</a>');
				// 		actions.push('&nbsp;<a class="btn btn-info btn-xs ' + depotFlag + '" href="javascript:void(0)" onclick="depot(\'' + row.feedId + '\')"><i class="fa fa-key"></i>出库</a>');
				// 		return actions.join('');
		        //     }
		        // }
		        ]
            };
            $.table.init(options);
        });

		/* 出库操作 */
		function depot(feedId) {
			var url = prefix + '/depot/' + feedId;
			$.modal.open("出库", url);
		}

		$('.top-link').click(function () {
			var index = $(this).index();
			switch (index) {
				case 0:
                    window.location.reload();
                    return;
				case 1:
                    window.location.href = ctx + 'system/ncChickenFeedLog/chicken';
					return;
			}
		})
        setTitle("饲料管理-主饲料饲管理",true)
    </script>
</body>
</html>